var gulp = require('gulp'),
less = require('gulp-less'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
concat = require('gulp-concat'),
notify = require('gulp-notify'),
sass = require('gulp-ruby-sass')

gulp.task('styles', function() {
	return gulp.src('src/css/*.less')
	.pipe(less())
	.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
	.pipe(minifycss())
	.pipe(rename('main.min.css'))
	.pipe(gulp.dest('./css'))
	.pipe(notify({ message: 'Styles task complete' }));
});

gulp.task('scripts', function() {
	return gulp.src('src/js/*.js')
	.pipe(concat('main.min.js'))
	.pipe(uglify())
	.pipe(gulp.dest('./js'))
	.pipe(notify({ message: 'Scripts task complete' }));
});

gulp.task('watch', function() {
    // Watch .less files
    gulp.watch('src/css/*.less', ['styles']);
    // Watch .js files
    gulp.watch('src/js/*.js', ['scripts']);
});